<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="UTF-8">
  <title>Configuration</title>
</head>
<body>
<h1>Configuration</h1>

<!-- 添加配置表单 -->
<form method="post" action="/config/add">
  <input type="text" name="key" placeholder="Key" />
  <input type="text" name="value" placeholder="Value" />
  <button type="submit">Add Config</button>
</form>

<!-- 配置列表 -->
<table>
  <tr>
    <th>Name</th>
    <th>Value</th>
    <th>Edit</th>
    <th>Delete</th>
  </tr>
  <tr th:each="config : ${configs}">
    <td th:text="${config.key}"></td>
    <td th:text="${config.value}"></td>
    <td>
      <form method="get" th:action="@{/config/edit/{name}(name=${config.key})}">
        <button type="submit">Edit</button>
      </form>
    </td>
    <td>
      <form method="post" th:action="@{/config/del/{name}(name=${config.key})}">
        <button type="submit">Delete</button>
      </form>
    </td>
  </tr>
</table>

<!-- 导出配置按钮 -->
<form method="get" action="/config/export">
  <button type="submit">Export Config</button>
</form>

</body>
</html>
